import {createRouter, createWebHistory} from 'vue-router'

const router = createRouter({
    history: createWebHistory(import.meta.env.BASE_URL),
    routes: [
        {
            path: '/',
            name: 'home',
            component: () => import('@/views/Home.vue')
        },
        {
            path: '/home',
            redirect: '/'
        },
        {
            path: '/:id(\\d+)', // 动态路由，匹配任意ID进入对应商品详情页
            name: 'GoodsDetail',
            component: () => import('@/views/GoodsDetail.vue')
        },
        {
            path: '/login',
            component: () => import('@/views/LoginView.vue')
        },
        {
            path: '/order',
            component: () => import('@/views/Order.vue')
        },
        {
            path: '/history',
            component: () => import('@/views/History.vue')
        },
        {
            path: '/appointmentFail',
            component: () => import('@/views/test/AppointmentFailed.vue')
        },
        {
            path: '/appointmentSuccess',
            component: () => import('@/views/test/AppointmentSuccess.vue')
        },
        {
            path: '/check',
            component: () => import('@/views/test/Check.vue')
        }
    ]
})

export default router
